package com.ailk.aee.pcc.action;

import com.ailk.aee.pcc.server.UserPloyStateServer;
import com.asiainfo.appserver.Action;
import com.asiainfo.appserver.Request;
import com.asiainfo.appserver.Response;
import com.asiainfo.appserver.annotations.Function;
import com.asiainfo.appserver.annotations.Parameter;
import com.asiainfo.appserver.annotations.Type;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 删除策略状态
 *
 * @author pengzhang
 */
@Function(
        description = "删除用户策略状态", parameters = {
        @Parameter(name = "userId", type = Type.String, description = "用户ID", required = true),
        @Parameter(name = "ployCode", type = Type.String, description = "策略编码", required = true)
})
@Component
public class DeletePloyState implements Action {

    @Autowired
    private UserPloyStateServer ployServer;

    @Override
    public Response execute(Request request) throws Exception {
        String userId = request.getString("userId");
        String ployCode = request.getString("ployCode");

        ployServer.deletePloyUserState(userId, ployCode);
        return Response.success();
    }
}
